<%@ page import="java.util.Map" %>
<%@ page import="java.util.Set" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="bid.entity.User" %>
<%@ page import="bid.util.StringUtils" %>
<%@ page import="bid.dao.UserDao" %>
<%@ page import="bid.dao.impl.UserDaoImpl" %><%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2023-10-24
  Time: 15:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
  <%
      request.setCharacterEncoding("utf-8");
      User user=new User();
      user.setName(request.getParameter("name"));
      user.setPassword(request.getParameter("password"));
      user.setUsername(request.getParameter("username"));
      user.setUnit(request.getParameter("unit"));
      user.setIdcard(request.getParameter("idcard"));
      user.setRoleid(Long.parseLong(request.getParameter("role")));
      user.setTelephone(request.getParameter("telephone"));
      user.setEnterdate(StringUtils.toDate(request.getParameter("enterdate")));
      UserDao userDao=new UserDaoImpl();
      int r = userDao.add(user);
      if(r>0){
          out.print("新增成功");
      }else{
          out.print("新增失败，请返回刷新再试");
      }
//      Map<String, String[]> map = request.getParameterMap();
//      //循环一下
//      for (Map.Entry<String, String[]> x:  map.entrySet()){
//          out.print("<p>");
//          out.print(x.getKey()+"==="+ Arrays.toString(x.getValue()));
//          out.print("</p>");
//      }

  %>
</body>
</html>
